package Train;

import java.util.Scanner;

public class twoDay {
    public static void main(String[] args) {
        //找出最长数字字符串
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String str = scanner.nextLine();
            int n = 0;//用于记录长度
            int max = 0;//记录最长长度
            int prev = 0;//记录起始位置
            for (int i = 0; i < str.length(); i++) {
                char c = str.charAt(i);
                if(c >= '0'  && c <= '9'){
                    n++;
                    if(max < n){
                        max = n;
                        prev = i-n+1;
                    }
                }else {
                    n = 0;

                }
            }
            System.out.println(str.substring(prev,prev+max));
        }
    }
    public int MoreThanHalfNum_Solution (int[] numbers) {
        // write code here
        //数组中出现次数超过一半的数字
        //1.排序,取中间值
        //2.哈希表
        //3.O(n)
        int count = 0;
        //由于出现的次数>一半,所以当count为1时,就是
        //临时变量
        int num = numbers[0];
        for (int i = 1; i < numbers.length; i++) {
            if(num == numbers[i]){
                count++;
            }else {
                if(count > 0){
                    count--;
                }else{
                    num = numbers[i];
                    count = 1;
                }
            }
        }
        int n = 0;
        for (int number : numbers) {
            if (number == num) {
                n++;
            }
        }
        return n > numbers.length/2?num:0;
    }
}
